<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$return=array();
if($_RQ['op']=='main'){
	//总签到排行，根据总签到次数进行排行
	$list=pdo_getslice('core_qiandao',array('uniacid'=>$_SESSION['uniacid']),array(1,20),$total,array('num count','mid'),'','num desc','mid');
//	$list=pdo_query('select count(mid) as num,mid from ims_core_qiandao where uniacid='.$_SESSION['uniacid'].' group by mid order by num desc limit 0,20');
	if($list){
		foreach($list as &$item){
			$member=pdo_get('core_members',array('id'=>$item['mid']),array('nickname','avatar'));
			$item=array_merge($item,$member);
		}
		$return['list']=$list;
	}
	exi($return);
}
if($_RQ['op']=='get_main'){
	$page=intval($_RQ['page']);
	if($page<2){
		exi('参数错误','error');
	}
	$list=pdo_getslice('core_qiandao',array('uniacid'=>$_SESSION['uniacid']),array($page,20),$total,array('num count','mid'),'','num desc','mid');
//	$list=pdo_query('select count(mid) as num,mid from ims_core_qiandao  where uniacid='.$_SESSION['uniacid'].' group by mid order by num desc limit '. $page.',20');
	if($list){
		foreach($list as &$item){
			$member=pdo_get('core_members',array('id'=>$item['mid']),array('nickname','avatar'));
			$item=array_merge($item,$member);
		}
	}
	exi($list);
}
if($_RQ['op']=='lianxu'){
	//连续签到排行
	$list=pdo_getslice('core_members',array('uniacid'=>$_SESSION['uniacid']),array(1,20),$total,array('sign_days','nickname','avatar'),'','sign_days desc');
	if($list){
		$return['list']=$list;
	}
	exi($return);
}
if($_RQ['op']=='get_lianxu'){
	$page=intval($_RQ['page']);
	if($page<2){
		exi('参数错误','error');
	}
//	$list=pdo_query('select sign_days,nickname,avatar from ims_core_members  order by sign_days desc limit '.$page.'0,20');
	$list=pdo_getslice('core_members',array('uniacid'=>$_SESSION['uniacid']),array($page,20),$total,array('sign_days','nickname','avatar'),'','sign_days desc');
	exi($list);
}